package com.party.core.service.commune;

import com.party.common.paging.Page;
import com.party.core.model.commune.CMemberIntegralBalanceLog;
import com.party.core.model.commune.CUserIntegral;
import com.party.core.model.commune.CUserIntegralMobileOutput;
import com.party.core.model.commune.CUserIntegralOutput;
import com.party.core.service.IBaseService;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @program: party
 * @description: 用户积分服务接口
 * @author: Hua Qunhao
 * @create: 2019-08-12 14:25
 **/
public interface ICUserIntegralService extends IBaseService<CUserIntegral> {

    /**
     * @Description:查询积分列表
     * @Param:Map<String, Object> params, Page page
     * @return: List<CUserIntegralOutput>
     * @Author: Hua Qunhao
     * @Date: 2019/8/15
     */
    List<CUserIntegralOutput> queryUserIntegralList(Map<String, Object> params, Page page);

    /**
     * @Description:获取总积分
     * @Param:CUserIntegral cUserIntegral
     * @return: Double
     * @Author: Hua Qunhao
     * @Date: 2019/8/15
     */
    Double getUserItemFractionSum(CUserIntegral cUserIntegral);

    /**
     * @Description: 通过机构id 获取积分排行榜
     * @Param:partnerId
     * @return:List<CUserIntegralMobileOutput>
     * @Author: Hua Qunhao
     * @Date: 2019/8/30
     */
    List<CUserIntegralMobileOutput> queryUserIntegralMobileList(Map<String,Object> params,Page page);

    /***
    * web端获取 积分排行榜
    * @Date 11:29 2019/11/12
    * @param params
    * @param page
    * @return
    **/
    List<CUserIntegralMobileOutput> queryUserIntegralWebList(Map<String,Object> params,Page page);

    /**
     * @Description: 通过机构id和机构用户关系表id  获取当前用户在该机构下的积分排行
     * @Param:partnerId,pmId
     * @return:CUserIntegralMobileOutput
     * @Author: Hua Qunhao
     * @Date: 2019/8/30
     */
    CUserIntegralMobileOutput queryUserIntegralMobile(Map<String,Object> params);


    /**
     * @Description: 通过机构id 获取影响力排行榜
     * @Param:partnerId
     * @return:List<CUserIntegralMobileOutput>
     * @Author: Hua Qunhao
     * @Date: 2019/8/30
     */
    List<CUserIntegralMobileOutput> queryIntegralInfluenceRankingList(Map<String,Object> params,Page page);


    /**
     * @Description: 通过机构id和机构用户关系表id  获取当前用户在该机构下的影响力排行
     * @Param:partnerId
     * @return:List<CUserIntegralMobileOutput>
     * @Author: Hua Qunhao
     * @Date: 2019/8/30
     */
    CUserIntegralMobileOutput queryIntegralInfluenceRanking(Map<String,Object> params);

    /**
     * @Description:获取我推荐的人
     * @Param:parentId
     * @return:List<CUserIntegralMobileOutput>
     * @Author: Hua Qunhao
     * @Date: 2019/9/9
     */
    List<CUserIntegralMobileOutput> getRecommendPersonList(Map<String, Object> params, Page page);

    /**
     * @Description:获取推荐人的影响力
     * @Param:a
     * @return:a
     * @Author: Hua Qunhao
     * @Date: 2019/9/9
     */
    Double getRecommendItemFractionSum(String parentId,String typeId);

    /***
    * web端 过滤条件，获取机构下的
    * @Date 13:55 2019/10/14
    * @param params
    * @param page
    * @return
    **/
    List<CUserIntegralMobileOutput> queryIntegralInfluenceRankingListWithWeb(Map<String, Object> params , Page page);

    /***
    * web端，过滤条件，查询总积分
    * @Date 17:59 2019/10/14
    * @param params
    * @return
    **/
    Double getUserItemFractionSumWithParams(Map<String, Object> params);

    /***
    * web端，过滤条件，查询总影响力
    * @Date 10:26 2019/10/15
    * @param params
    * @return
    **/
    Double getRecommendItemFractionSumWithParam(Map<String, Object> params);

    /**
    *
    * 查询所有有pmId
    * @author yifeng
    * @date 16:31 2019/11/13
    * @return 积分列表
    **/
    List<String> groupByPmIdList();

    void batchUpdatePartnerAndMember(String partnerId, String memberId, String pmId);


    Double getMemberGroupScoreByTypeId(List<String> memberGroupIds,Map<String, Object> params);

    List<CMemberIntegralBalanceLog> queryUserIntegralAll(Map<String,Object> params);
}